home *** CD-ROM | disk | FTP | other *** search
- ;BB.Flash - Blanker-module for BlitzBlank
- ;Copyright 1993 by Thomas Boerkel
-
- CloseEd
-
- NEWTYPE.spritedata
- a.w
- b
- c
- d
- e
- f
- End NEWTYPE
-
- NEWTYPE.tags
- a.l
- b
- c
- d
- e
- f
- End NEWTYPE
-
- DEFTYPE.spritedata *sprdata
- DEFTYPE.SimpleSprite spr
- DEFTYPE.Screen *myscreen
- DEFTYPE.NewScreen newscreen
- DEFTYPE.Message *msg
- DEFTYPE.MsgPort *port
- DEFTYPE.tags tags
- DEFTYPE.l
-
- Statement stringborder{x,y,w,h}
- Wline x+1,y+h+2,x+1,y,x+w+8,y,1
- Wline x+w+10,y-1,x+w+10,y+h+4,x-1,y+h+4,1
- Wline x,y+h+3,x,y,1
- Wline x+w+11,y-1,x+w+11,y+h+4,1
- Wline x-1,y+h+3,x-1,y-1,x+w+10,y-1,2
- Wline x+w+9,y,x+w+9,y+h+3,x+1,y+h+3,2
- Wline x-2,y+h+4,x-2,y-1,2
- Wline x+w+8,y+1,x+w+8,y+h+2,2
- End Statement
-
- Statement drawflash{x,y,b}
- SHARED *rp,width,height
- dx1=Int(Rnd(61))-30
- dy1=Int(Rnd(100))+10
- dx2=Int(Rnd(41))-20
- dy2=Int(Rnd(100))+10
- If y+dy1<height AND y+dy2<height
- Move_ *rp,x,y
- Draw_ *rp,x+dx1,y+dy1
- drawflash{x+dx1,y+dy1,b}
- b+1
- If b<2 AND y>height/4 AND Rnd(3)<1
- Move_ *rp,x,y
- Draw_ *rp,x+dx2,y+dy2
- drawflash{x+dx2,y+dy2,b}
- EndIf
- EndIf
- End Statement
-
- al=0
- Select Par$(1)
- Case "BLANK"
-
- name$="BB.BlankModule"+Chr$(0)
- *port=CreateMsgPort_()
- *port\mp_Node\ln_Name=&name$
- *port\mp_Node\ln_Pri=1
- AddPort_ *port
-
- SetTaskPri_ FindTask_(0),Val(Par$(8))
- *sprdata=AllocMem_(SizeOf.spritedata,#MEMF_CHIP|#MEMF_CLEAR)
-
- Gosub readconfig
-
- width=Val(Par$(2))
- height=Val(Par$(3))
- mode=Val(Par$(4))
- monitor=Val(Par$(5))
- depth=1
- colors=2^depth
- title$="BB.Flash.Screen"+Chr$(0)
- newscreen\LeftEdge=0,0,width,height,depth
- newscreen\ViewModes=0,#CUSTOMSCREEN|#SCREENBEHIND,0,&title$
- tags\a=#SA_DisplayID
- tags\b=$10000*monitor+mode
- tags\c=0
- *myscreen=OpenScreenTagList_(newscreen,tags)
- If *myscreen
- *vp=*myscreen\ViewPort
- *rp=*myscreen\RastPort
- SetRGB4_ *vp,0,0,0,0
- SetRGB4_ *vp,1,0,0,0
- SetAPen_ *rp,0
- RectFill_ *rp,0,0,width-1,height-1
- ScreenToFront_ *myscreen
- VWait
- ChangeSprite_ 0,spr,*sprdata
-
- Repeat
-
- SetAPen_ *rp,1
- For i=1 To Rnd(20)
- Delay_ 5
- *msg=GetMsg_(*port)
- If *msg
- e=1
- i=25
- EndIf
- Next i
- If e=0
- VWait
- SetRGB4_ *vp,0,0,10,10
- SetRGB4_ *vp,1,15,15,15
- af=Int(Rnd(flash))+1
- For i=1 To af
- drawflash{width/4+Rnd(width/2),0,0}
- Next i
- Delay_ af+2
- VWait
- SetRGB4_ *vp,0,0,0,0
- SetRGB4_ *vp,1,0,0,0
- SetAPen_ *rp,0
- RectFill_ *rp,0,0,width-1,height-1
- *msg=GetMsg_(*port)
- EndIf
- Until *msg
-
-
- CloseScreen_ *myscreen
- EndIf
- FreeMem_ *sprdata,SizeOf.spritedata
- RemPort_ *port
- DeleteMsgPort_ *port
-
-
- Case "INFO"
-
- title$="Flash"+Chr$(0)
- reqtext$="Flash - Module for BlitzBlank"+Chr$(10)
- reqtext$+Chr$(169)+" 1993 by Thomas Brkel"+Chr$(10)+Chr$(10)
- reqtext$+"You see flashes in the dark."+Chr$(10)+Chr$(10)
- reqtext$+"Choose the max. number of flashes in the config-window."+Chr$(0)
- gadget$="OK"+Chr$(0)
-
- easy.EasyStruct\es_StructSize=SizeOf.EasyStruct
- easy\es_Title=&title$
- easy\es_TextFormat=&reqtext$
- easy\es_GadgetFormat=&gadget$
-
- EasyRequestArgs_ 0,easy,0,0
-
- Case "CONFIG"
- *myscreen=LockPubScreen_(0)
- width=*myscreen\Width
- height=*myscreen\Height
- font=*myscreen\Font\ta_YSize
- Gosub readconfig
- WbToScreen 0
- BorderPens 0,0
- StringGadget 0,100,25,0,0,4,40
- Window 0,width/2-90,height/2-25,180,50,$100e,"Flash",1,2,0
- stringborder{100,25,40,8}
- WColour 2
- WLocate 32,24-font
- Print "Flash:"
- WLocate 32,24-font+8
- Print "(1-5)"
- SetString 0,0,Str$(flash)
- ActivateString 0,0
- Repeat
- ev=WaitEvent
- Until ev=$200 OR ev=$40
- flash=Val(StringText$(0,0))
- Free Window 0
- Gosub writeconfig
- UnlockPubScreen_ 0,*myscreen
- End Select
-
- End
-
-
- .readconfig
- path$=Par$(9)
- For i=10 To NumPars
- path$=path$+" "+Par$(i)
- Next i
- If ReadFile(0,path$+"BB.Modules.config")
- FileInput 0
- While NOT Eof(0)
- If Edit$(100)="*** Flash ***"
- flash=Val(Edit$(5))
- EndIf
- Wend
- DefaultInput
- CloseFile 0
- EndIf
- Gosub checkval
- Return
-
-
- .writeconfig
- Gosub checkval
- If ReadFile(0,path$+"BB.Modules.config")
- If WriteFile(1,path$+"BB.Modules.temp")
- FileInput 0
- FileOutput 1
- While NOT Eof(0)
- f$=Edit$(100)
- If f$="*** Flash ***"
- Repeat
- f2$=Edit$(100)
- Until Eof(0) OR Left$(f2$,3)="***"
- If NOT Eof(0) Then NPrint f2$
- Else
- NPrint f$
- EndIf
- Wend
- CloseFile 1
- EndIf
- CloseFile 0
- EndIf
- KillFile path$+"BB.Modules.config"
- f$=path$+"BB.Modules.temp"+Chr$(0)
- f2$=path$+"BB.Modules.config"+Chr$(0)
- Rename_ &f$,&f2$
- If OpenFile(0,path$+"BB.Modules.config")
- FileOutput 0
- FileSeek 0,Lof(0)
- NPrint "*** Flash ***"
- NPrint flash
- CloseFile 0
- EndIf
- Return
-
- .checkval
- If flash<1 Then flash=1
- If flash>5 Then flash=5
- Return
-
-